package spike.utils;

/**
 * Created by ylyang on 15/02/2017.
 */
public class StopWatchUtils {
    private long fromTime;

    public StopWatchUtils() {
        fromTime = System.currentTimeMillis();
    }

    public long popStepUseTime() {
        long currentTime = System.currentTimeMillis();

        long useTime = currentTime - fromTime;

        fromTime = currentTime;

        return useTime;
    }

    public long peekStepUseTime() {
        return System.currentTimeMillis() - fromTime;
    }

    public String popStepUseTime(String stepName) {
        return stepName + " use time " + popStepUseTime();
    }
}
